<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>山寨版网页连连看</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="lianliankan.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="JavaScript" src="javascript/jquery-1.3.2.min.js" charset="utf-8" ></script>
<script type="text/javascript" language="JavaScript" src="plugins/sort-left.js" charset="utf-8" ></script>
<script type="text/javascript" language="JavaScript" src="plugins/sort-down.js" charset="utf-8" ></script>
<script type="text/javascript" language="JavaScript" src="plugins/sort-right.js" charset="utf-8" ></script>
<script type="text/javascript" language="JavaScript" src="plugins/sort-up.js" charset="utf-8" ></script>
<script type="text/javascript" language="JavaScript" src="javascript/map-main.js" charset="utf-8" ></script>
<script type="text/javascript" language="JavaScript" src="levels.js" charset="utf-8" ></script>
<script type="text/javascript" language="JavaScript">
$(function(){
	var $map=$("#gameMap"),
		$next=$("#next"),
		$result=$("#result"),
		$replay=$("#replay"),
		$gameTitle=$("#gameTitle");
	var successHandle = function(levelInfo){
		$result.hide();
		$next.hide();
		$replay.hide();
		$map.fadeOut("normal",function(){
			if(levelInfo.nextIndex){
				$next.show().click(function(){
					$result.fadeOut("normal",function(){
						replay(levelInfos[levelInfo.nextIndex]);
					});
				});
			}else{
				$gameTitle.show();
			}
			$result.fadeIn("normal");
		});
	};
	
	var currentLevel=null;
	var replay=function(levelInfo){
		$map.fadeOut("normal",function(){
			$map.empty().fadeIn("normal").llk(levelInfo);
			$replay.show();
		});
	}
	var init = function(){
		$result.hide();
		$replay.hide();
		for(var levelIndex in levelInfos){
			var levelInfo = levelInfos[levelIndex];
			levelInfo.successHandle = successHandle;
			var $li=$("<li/>"),$a=$("<a href='#'>"+levelInfo.name+"</a>");
			$a.data("info",levelInfo);
			$a.click(function(){
				var levelInfo = $(this).data("info");
				currentLevel=levelInfo;
				replay(levelInfo);
				$replay.click(function(){
					replay(currentLevel);
				});
				$gameTitle.hide();
			});
			$li.html($a);
			$gameTitle.append($li);
		}
	}
	init();
});
</script>
</head>
<body>
<ul id="gameTitle">
</ul>
<div id="gameMap"></div>
<div id="toolbar"><input type="button" value="replay" id="replay"/></div>
<div id="result">恭喜你，成功了！<input id="next" value="下一关" type="button"/></div>
<div id="test"></div>
</body>
</html>